package com.zte.moon.yutu;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 14-1-5
 * Time: 上午2:25
 * To change this template use File | Settings | File Templates.
 */
public enum Direction  {
    NORTH,EAST,SOUTH,WEST;



    public static Direction valueof(String str){
        if (str.equals("N"))
            return Direction.NORTH;
        else if (str.equals("E"))
            return Direction.EAST;
        else if (str.equals("S"))
            return Direction.SOUTH;
        else if (str.equals("W"))
            return Direction.WEST;
        else
            return null;
    }

    public String tostring(){
        if (this == Direction.NORTH)
            return "N";
        else if (this == Direction.EAST)
            return "E";
        else if (this == Direction.SOUTH)
            return "S";
        else if (this == Direction.WEST)
            return "W";
        else
            return "Error";
    }
}
